@d Write index of file names
@
if (file_names)
fputs("
small
beginlist
setlength
itemsep-
parsep",
tex_file);
fputs("
setlength
itemindent-
leftmargin", tex_file);
format_entry(file_names, tex_file, TRUE);
fputs("
endlist", tex_file);
c = source_get();
@
@d Write index of macro names
@
if (macro_names)
fputs("
small
beginlist
setlength
itemsep-
parsep",
tex_file);
fputs("
setlength
itemindent-
leftmargin", tex_file);
format_entry(macro_names, tex_file, FALSE);
fputs("
endlist", tex_file);
c = source_get();
@
@o latex.c @static void format_entry(name, tex_file, file_flag) Name *name; FILE *tex_file; int file_flag; while (name) format_entry(name->llink, tex_file, file_flag); @<Format an index entry@> name = name->rlink; @| format_entry @
@d Format an index entry
@
fputs("
item ", tex_file);
if (file_flag)
fprintf(tex_file, "
verb@@ยจ@<Write file's defining scrap numbers@>
else
fprintf(tex_file, "
langle@<Write defining scrap numbers@>
fputs("
rangle ", tex_file);
@<Write referencing scrap numbers@>
putc('', tex_file);
@
@d Write file's defining scrap numbers
@
Scrap_Node *p = name->defs;
fputs("
footnotesize Defined by scrap", tex_file);
if (p->next)
fputs("s ", tex_file);
print_scrap_numbers(tex_file, p);
else
putc(' ', tex_file);
write_single_scrap_ref(tex_file, p->scrap);
putc('.', tex_file);
putc('', tex_file);
@
@d Write defining scrap numbers @ Scrap_Node *p = name->defs; if (p) int page; write_scrap_ref(tex_file, p->scrap, TRUE, &page); p = p->next; while (p) write_scrap_ref(tex_file, p->scrap, FALSE, &page); p = p->next; else putc('?', tex_file); @
@d Write referencing scrap numbers
@
Scrap_Node *p = name->uses;
fputs("
footnotesize ", tex_file);
if (p)
fputs("Referenced in scrap", tex_file);
if (p->next)
fputs("s ", tex_file);
print_scrap_numbers(tex_file, p);
else
putc(' ', tex_file);
write_single_scrap_ref(tex_file, p->scrap);
putc('.', tex_file);
else
fputs("Not referenced.", tex_file);
putc('', tex_file);
@
@d Write index of user-specified names
@
if (user_names)
fputs("
small
beginlist
setlength
itemsep-
parsep",
tex_file);
fputs("
setlength
itemindent-
leftmargin", tex_file);
format_user_entry(user_names, tex_file);
fputs("
endlist", tex_file);
c = source_get();
@
@o latex.c @static void format_user_entry(name, tex_file) Name *name; FILE *tex_file; while (name) format_user_entry(name->llink, tex_file); @<Format a user index entry@> name = name->rlink; @| format_user_entry @
@d Format a user index entry
@
Scrap_Node *uses = name->uses;
if (uses)
int page;
Scrap_Node *defs = name->defs;
fprintf(tex_file, "
item
verb@@if (uses->scrap < defs->scrap)
write_scrap_ref(tex_file, uses->scrap, TRUE, &page);
uses = uses->next;
else
if (defs->scrap == uses->scrap)
uses = uses->next;
fputs("
underline", tex_file);
write_single_scrap_ref(tex_file, defs->scrap);
putc('', tex_file);
page = -2;
defs = defs->next;
while (uses || defs)
if (uses && (!defs || uses->scrap < defs->scrap))
write_scrap_ref(tex_file, uses->scrap, FALSE, &page);
uses = uses->next;
else
if (uses && defs->scrap == uses->scrap)
uses = uses->next;
fputs(",
underline", tex_file);
write_single_scrap_ref(tex_file, defs->scrap);
putc('', tex_file);
page = -2;
defs = defs->next;
fputs(".", tex_file);
@